package com.collect.discord.jda;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.requests.GatewayIntent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ Author :hky
 * @ Date  : Created in 10:48 2022-09-19
 * @ Version discord
 * @ Decribtion : $
 */
@Configuration
public class JavaBotApp {
    @Bean
    public void javaBot() throws InterruptedException {
        String proxyHost = "127.0.0.1";
        String proxyPort = "7890";
        //开启http代理
        System.setProperty("http.proxyHost", proxyHost);
        System.setProperty("http.proxyPort", proxyPort);
        // 对https也开启代理
        System.setProperty("https.proxyHost", proxyHost);
        System.setProperty("https.proxyPort", proxyPort);
        //创建事件
        String token = "MTAyMTIzNjk4MTMxNDg5NTg4Mw.GzQoQx.5vkQ6qWpcFZl02DAqh2fsCKbwh57IaVTNCazdo";
        JDA jda = JDABuilder.createLight(token, GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MEMBERS).build().awaitReady();
        jda.addEventListener(new MessageEvent());
    }
}
